<?php
class MysqlConn {
   public function __construct() {
      require_once("db_config.php");
      $this->conn = mysql_connect(DB_SERVER, DB_USER, DB_PWD);
      $this->my_db = mysql_select_db(DB_NAME, $this->conn);
   }

   public function query($sql) {
      $this->result = mysql_query($sql, $this->conn);
      $errno = mysql_errno();
      $error = mysql_error();
      $this->lastInsertID = mysql_insert_id();
      return $this->result;
   }

   public function next() {
      return $row = mysql_fetch_array($this->result);
   }

   public function close() {
      mysql_free_result($this->result);
   }

   public function escapeString($str) {
      return mysql_escape_string($str);
   }

   public function getErrNo() {
      return $this->errno;
   }

   public function getError() {
      return $this->error;
   }

   public function getLastInsertID() {
      return $this->lastInsertID;
   }

   private $conn;
   private $my_db;
   private $result;
   private $errno;
   private $error;
   private $lastInsertID;
}
?>